//
//  SVPAlertManager.m
//  QuickCure
//
//  Created by MootYue on 16/5/5.
//  Copyright © 2016年 ayumi. All rights reserved.
//

#import "SVPAlertManager.h"

@implementation SVPAlertManager
/**
 已经自动dismiss 直接使用  alertLoading  alertSuccessStatus  和alertErrorStatus 3个方法就行
 
 */


//转圈 lalala
+(void)alertLoading{
    [SVProgressHUD show];
    [self disMiss:1.2];
    
}

//成功提示
//使用方式：[SVPAlertManager alertSuccessStatus:@"想要弹出的消息"]
+(void)alertSuccessStatus:(NSString *)success{
    [SVProgressHUD showSuccessWithStatus:success];
//    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    [self disMiss:1];
}

//错误提示
//使用方式：[SVPAlertManager alertErrorStatus:@"想要弹出的消息"]
+(void)alertErrorStatus:(NSString *)error{
    [SVProgressHUD showErrorWithStatus:error];
//    [SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
    [self disMiss:1.2];
}


//========================== 直接使用上面的方法就好===================/

//隐藏提示框
+(void)dismissLoading{
    [SVProgressHUD show];
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        dispatch_async(dispatch_get_main_queue(), ^{
            [SVProgressHUD dismiss];
        });
    });
}

//解决弹框消失等待时长太久的问题不用管这里
+(void)disMiss:(int)time{
    [self performSelector:@selector(dismissLoading) withObject:nil afterDelay:time];
}


@end
